<template>
	<view class="recharge_record">
		<view class="recharge_record_title">
			<view class="recharge_record_title_list" :style="{width:width}" v-for="(item,index) in titleList"
				:key="index">
				{{item}}
			</view>
		</view>
		<view class="recharge_record_content">
			<view class="recharge_record_content_list" v-for="(item,index) in contentList" :key="index">
				<view :style="{width:width}">
					{{item.createTime}}
				</view>
				<view :style="{width:width}">
					{{item.username}}
				</view>
				<view :style="{width:width}">
					{{item.totalFee}}
				</view>
				<view :style="{width:width}">
					{{item.remittanceAccount}}
				</view>
				<view :style="{width:width}" v-if="type==0">
					{{item.financingReviewStatus==0?'未审核':item.financingReviewStatus==1?'通过':'驳回'}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				titleList: ["日期", "手机号", "充值金额", "汇款账户", "审核状态"],
				contentList: [],
				type: 0,
				width: "20%"
			}
		},
		onLoad() {

		},
		onShow() {
			this.$http({
				url: '/offlinePayLog/getOfflinePayLog',
				method: 'GET',
			}).then(res => {
				console.log(res)
				if (res.data.code === 200) {
					this.contentList = res.data.data
					this.contentList.map(item => {
						item.createTime = this.dateArrayTransfer(item.createTime)
					})
				}
				if (res.data.data.length == 0) {
					uni.showToast({
						title: '暂无记录',
						icon: 'error'
					})
				}
			})
		},
		methods: {
			dateArrayTransfer(dateArray) {
				if (dateArray == null || dateArray == '') {
					return '';
				}
				var returnDate = dateArray[0] + "-" +
					this.returnDoubleNum(dateArray[1]) + "-" +
					this.returnDoubleNum(dateArray[2]) + " " +
					this.returnDoubleNum(dateArray[3]) + ":" +
					this.returnDoubleNum(dateArray[4]) + ":" +
					this.returnDoubleNum(dateArray[5]);
				return returnDate;
			},
			returnDoubleNum(number) {
				return (Array(2).join(0) + number).slice(-2); //创建一个长度为2的数组，且默认用0填充；然后用传过来的数添加都右边，然后从右向左截取两位！
			},
		},
	}
</script>


<style lang="scss" scoped>
	@import './rechargeRecord.css'
</style>
